#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QUdpSocket>
#include <QTcpSocket>

#include <QSqlDatabase>
#include <QSqlQuery>
#include <QSqlQueryModel>
#include <QSqlError>
#include <QListWidgetItem>
#include <QComboBox>

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

struct _IOBuf_
{
    quint16 dec;
    quint8 bit;
    QListWidgetItem *point;
};

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

private slots:
    void on_btnConnect_clicked();

    void on_pushButton_clicked();

    void on_btn_reco1addlist_clicked();

    void on_btn_reco1declist_clicked();

    void on_btn_reco1addnote_clicked();

    void on_btn_reco1decnote_clicked();

    void on_pushButton_2_clicked();

private:
    Ui::MainWindow *ui;
    QUdpSocket *m_udpSocketAll;
    QTcpSocket *m_tcpSocketACh,*m_tcpSocketBCh;
    QByteArray m_bufACh, m_bufBCh;
    QSqlDatabase db;
    QVector<struct _IOBuf_> m_ioVectorA, m_ioVectorB;

    void AnalyseDateA(QByteArray i_dat);
    void AnalyseDateB(QByteArray i_dat);
    void CopyBtnInit();

    //
    QVector<QComboBox*> m_cbReco1;
    //SQL定义
    QVector<int> m_decReco;
    QVector<QString> m_defReco;
};
#endif // MAINWINDOW_H
